﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Templates/Template.Master" Inherits="System.Web.Mvc.ViewPage<TaxiCaosWeb.Models.TarifarioDescuento>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">

Registrar Reserva
    
</asp:Content>


<asp:Content ID="Content3" ContentPlaceHolderID="menuContent" runat="server">
<%
    string[] menuArray = { "0", "0", "0", "0", "0", "1", "0", "0" };
    Session["menuArray"] = menuArray;
%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
 
    <script type="text/javascript">
        function submitForm(btnClicked) {
        //function submitForm() {
           var $form = $(btnClicked).parents('form');
           //var $form = $("#tarifarioForm");

            $.ajax({
                type: "POST",
                url: $form.attr('action'),
                //url: '/Reserva/Tarifario',
                data: $form.serialize(),
                error: function (xhr, status, error) {
                    $("#loading-div-background").hide();
                    $.msgBox({
                        content: error,
                        type: "error"
                    });
                },
                success: function (data) {
                    $("#loading-div-background").hide();

                    if (data.TipoMensaje == 'WARN') {
                        $.msgBox({
                            content: data.Message,
                            type: "alert"         
                        });
                        }
                    $('#Tarifario_Monto').val(data.MontoBruto);
                    $('#Descuento_PorcentajeDescuento').val(data.PorcentajeDescuento);
                    $('#MontoTotal').val(data.MontoNeto);
                    $('#Mensaje_Error').text(data.Message);

                },
                beforeSend: function (data) {
                    $("#loading-div-background").show();
                }
            });

            return false; 

        }

    </script>

    <div class="nosotros">
        <h1>Tarifario</h1>

   <% using (Html.BeginForm("Tarifario", "Reserva", FormMethod.Post, new { @id = "tarifarioForm", @class = "cmxform" })) {%>
            <table>
                <tr>
                    <td>
                        <label style="width:100px;text-align:left;font-size:1.2em;font-weight:bold">Origen:</label>
                    </td>
                    <td> 
                        <div class="editor-field">
                        <%= Html.DropDownList("distritoOrig",
                                                             new SelectList((IEnumerable)ViewData["DistritosOrigen"], "IdCatalogo", "Descripcion", ViewData["distriOrigValueSelected"]))%>
                         </div>  
                    </td>
                </tr>
                <tr>
                    <td>
                        <label style="width:100px;text-align:left;font-size:1.2em;font-weight:bold">Destino:</label>
                    </td>
                    <td>
                        <div class="editor-field">
                            <%= Html.DropDownList("distritoDest",
                                                             new SelectList((IEnumerable)ViewData["DistritosDestino"], "IdCatalogo", "Descripcion", ViewData["distritoDestValueSelected"]))%>
                        </div>
                    </td>
                </tr>
                 <tr>
                    <td></td>
                </tr>
                <tr>
                    <!--<td><input id="btnSubmit" type="submit" value="Calcular Precio" style="background-color: steelblue;
                        color: white; font-weight: bold; margin-top: 5px;"  />
                    </td>-->

                    <td><input type="button" value="Calcular Precio" style="background-color: steelblue;
                        color: white; font-weight: bold; margin-top: 5px;" onclick="submitForm(this);" />
                    </td>
                </tr>
           </table>

           <!-- <table>
            <tr>
                <td>
                <div id="Mensaje_Error" class="editor-field" style="color:Red;font-weight:bold;margin-top:auto;font-size:1.2em">
                <%: ViewData["ErrorTarifario"]%>
                </td>
                </div>
            </tr>  
            </table>-->
      
         <fieldset style="width:70%">
          <legend style="font-size:medium"><b>Detalle Tarifa</b></legend>
          <table style="width:80%;text-align:left;font-weight:bold;font-size:1.2em">
            <tr>
                <td>
                <label style="width:100px;text-align:left;font-weight:bold;font-size:0.9em">Monto Bruto:</label>
                </td>
                <td>
                <div id="Monto_Bruto" class="editor-field">
                    <%: Html.TextBoxFor(Model => Model.Tarifario.Monto, new { @disabled = "" })%>
                    <!--<%: Html.TextBoxFor(Model => Model.MontoBruto, new { @disabled = "" })%>-->
                </div>
                </td>
            </tr>
            <tr>
                <td>
                <label style="width:100px;text-align:left;font-weight:bold;font-size:0.9em">% Dscto:</label>
                </td>
                <td>
                <div id="Porcentaje_Descuento"class="editor-field">
                   <%: Html.TextBoxFor(Model => Model.Descuento.PorcentajeDescuento, new { @disabled = "" })%>
                </div>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2">
                <hr></hr>
                </td>
            </tr>
            <tr>
                <td>
                <label style="width:100px;text-align:left;font-weight:bold;font-size:0.9em">Monto Neto:</label>
                </td>
                <td>
                <div id="Monto_Neto" class="editor-field" style="border:0px">
                    <%: Html.TextBoxFor(Model => Model.MontoTotal, new { @disabled = "" })%>
                </div>
                </td>
            </tr>
          </table>
          

        </fieldset>

           <br />
         <div style="font-weight: bold;">
            <td><a class="tryitbtn" style="margin-top:5px;" href="/Reserva/Reserva">Confirmar</a>   </td>
            <td><a class="tryitbtn" style="margin-top:5px;" href="/Reserva/Reserva">Regresar</a>   </td>
         </div> 
        </div>
                   
    <% } %>
    
       
        

</asp:Content>
